package xyz.yuzegod.megawalls.classes;

import org.bukkit.Material;
import xyz.yuzegod.megawalls.game.GamePlayer;
import xyz.yuzegod.megawalls.stats.KitStatsContainer;

public abstract class Skill implements Upgradeable
{
    public static final String TICK = "§a§l✓";
    public static final String FORK = "§c§l✕";
    private String name;
    private Classes classes;
    
    public Skill(final String name, final Classes classes) {
        this.name = name;
        this.classes = classes;
    }
    
    @Override
    public Material getIconType() {
        return this.getClasses().getIconType();
    }
    
    @Override
    public byte getIconData() {
        return this.getClasses().getIconData();
    }
    
    public boolean use(final GamePlayer gamePlayer, final KitStatsContainer kitStats) {
        return true;
    }
    
    public String getSkillTip(final GamePlayer gamePlayer) {
        return this.classes.getNameColor() + "§l" + this.name + " " + ((gamePlayer.getEnergy() == 100) ? "§a§l✓" : "§c§l✕");
    }
    
    @Override
    public int getCost(final int level) {
        if (this.maxedLevel() == 5) {
            switch (level) {
                case 2: {
                    return 1000;
                }
                case 3: {
                    return 2000;
                }
                case 4: {
                    return 4000;
                }
                case 5: {
                    return 7500;
                }
                default: {
                    return 999999;
                }
            }
        }
        else {
            switch (level) {
                case 2: {
                    return 2000;
                }
                case 3: {
                    return 5000;
                }
                default: {
                    return 999999;
                }
            }
        }
    }
    
    @Override
    public String getName() {
        return this.name;
    }
    
    public Classes getClasses() {
        return this.classes;
    }
}
